from functools import reduce
from operator import add, mul
from inspect import signature


def hello(input: str, de: int = 10) -> str:
    """
    hello [summary]

    [extended_summary]

    Args:
        input (str): [description]

    Returns:
        str: [description]
    """
    pass


def factorial(n: int) -> int:
    """
    Cacludate input factorial value

    Args:
        n (int): input

    Returns:
        int: output
    """
    return 1 if n < 2 else n * factorial(n - 1)


def fact(n:int) -> int:
    """
    fact functional programming

    Args:
        n (int): [description]

    Returns:
        int: [description]
    """
    # lambda way
    # return reduce(lambda a, b: a * b, range(1, n + 1))
    # functional way
    return reduce(mul, range(1, n + 1))



if __name__ == "__main__":
    # map and filter marked outdated and deprecated
    values1 = list(map(factorial, range(6)))
    values2 = [factorial(i) for i in range(6)]
    filtered_value1 = list(map(factorial, filter(lambda n: n % 2, range(6))))
    filtered_value2 = [factorial(i) for i in range(6) if i % 2]

    # reduce规约 also marked outdated (use sum, all, any)
    sum1 = reduce(add, range(100))
    sum2 = sum(range(100))
